﻿
package system.data;

import java.util.*;

import framework.core.*;
/*
	Author    :Jackey
	CreateTime:2008-03-03 10:27:53
*/
public class UserMenuinfoBase extends Table 
{
public static final String TABLE_NAME = "T_USER_MENUINFO";

private static final String BACKUP_TABLE_NAME = "T_USER_MENUINFO_BACKUP";

private static final String BACKUP_SEQ_NAME = "S_USER_MENUINFO_BACKUP";


public static final String ID = "ID";

public static final String USER_ID = "USER_ID";

public static final String USER_CODE = "USER_CODE";

public static final String MENU_ID = "MENU_ID";

public static final String MENU_CODE = "MENU_CODE";


public static Vector m_fields = null;


private String m_id = ""; //ID

private String m_user_id = ""; //用户ID

private String m_user_code = ""; //用户编码

private String m_menu_id = ""; //菜单ID

private int m_menu_code = Value.NULL_INT;  //菜单编码



	public String getId()
	{
	    return m_id;
	}
	public void  setId(String v)
	{
		if(getId().equals(v)) return ;
		m_id = v ;
		markDirty(ID);
	}



	

	public String getUserId()
	{
	    return m_user_id;
	}
	public void  setUserId(String v)
	{
		if(getUserId().equals(v)) return ;
		m_user_id = v ;
		markDirty(USER_ID);
	}



	

	public String getUserCode()
	{
	    return m_user_code;
	}
	public void  setUserCode(String v)
	{
		if(getUserCode().equals(v)) return ;
		m_user_code = v ;
		markDirty(USER_CODE);
	}



	

	public String getMenuId()
	{
	    return m_menu_id;
	}
	public void  setMenuId(String v)
	{
		if(getMenuId().equals(v)) return ;
		m_menu_id = v ;
		markDirty(MENU_ID);
	}



	

	public int getMenuCode()
	{
	    return m_menu_code;
	}
	public void  setMenuCode(int v)
	{
		if(getMenuCode()==v) return ;
		m_menu_code = v ;
		markDirty(MENU_CODE);
	}



	



	public String viewId(DBConnection con) throws Exception
	{
		return Value.view(getId());
	}

	public String viewUserId(DBConnection con) throws Exception
	{
		return Value.view(getUserId());
	}

	public String viewUserCode(DBConnection con) throws Exception
	{
		return Value.view(getUserCode());
	}

	public String viewMenuId(DBConnection con) throws Exception
	{
		return Value.view(getMenuId());
	}

	public String viewMenuCode(DBConnection con) throws Exception
	{
		return Value.view(getMenuCode());
	}



protected UserMenuinfoBase()
{
}

public void fill(UserMenuinfoPageData pageData) throws Exception
{

	if(pageData.getId()!=null)
	{	
		setId(pageData.getId());
	}

	if(pageData.getUserId()!=null)
	{	
		setUserId(pageData.getUserId());
	}

	if(pageData.getUserCode()!=null)
	{	
		setUserCode(pageData.getUserCode());
	}

	if(pageData.getMenuId()!=null)
	{	
		setMenuId(pageData.getMenuId());
	}

	if( pageData.getMenuCode()!=null && 
	   !pageData.getMenuCode().equals(""))
	{	
		setMenuCode(Integer.parseInt(pageData.getMenuCode()));
	}

}

public String getTableName() 
{
	return TABLE_NAME;
}

public String getBackupTableName() 
{
	return BACKUP_TABLE_NAME;
}

public String getBackupSeqName() 
{
	return BACKUP_SEQ_NAME;
}

public java.util.Vector getFields() 
{
	if(m_fields==null)
	{
		m_fields = new Vector();

		m_fields.add(new Field(ID,Value.TYPE_STRING,true,true,32,"ID"));

		m_fields.add(new Field(USER_ID,Value.TYPE_STRING,false,true,32,"用户ID"));

		m_fields.add(new Field(USER_CODE,Value.TYPE_STRING,false,true,50,"用户编码"));

		m_fields.add(new Field(MENU_ID,Value.TYPE_STRING,false,true,32,"菜单ID"));

		m_fields.add(new Field(MENU_CODE,Value.TYPE_INT,false,true,0,"菜单编码"));
		
	}
	return m_fields;
}

public void initObject(java.sql.ResultSet rs) throws Exception
{

	m_id = getString(rs,ID);

	m_user_id = getString(rs,USER_ID);

	m_user_code = getString(rs,USER_CODE);

	m_menu_id = getString(rs,MENU_ID);

	m_menu_code = getInt(rs,MENU_CODE);

	ms_new_flag = ConstDefine.NO;
}

public Value get(String f)
{

	if(f.equalsIgnoreCase(ID))
	{
		return new Value(getId());
	}

	if(f.equalsIgnoreCase(USER_ID))
	{
		return new Value(getUserId());
	}

	if(f.equalsIgnoreCase(USER_CODE))
	{
		return new Value(getUserCode());
	}

	if(f.equalsIgnoreCase(MENU_ID))
	{
		return new Value(getMenuId());
	}

	if(f.equalsIgnoreCase(MENU_CODE))
	{
		return new Value(getMenuCode());
	}
	
	return null;
}
public void set(String f,Value v) throws Exception
{

	if(f.equalsIgnoreCase(ID))
	{
		setId(v.getString());
	}

	if(f.equalsIgnoreCase(USER_ID))
	{
		setUserId(v.getString());
	}

	if(f.equalsIgnoreCase(USER_CODE))
	{
		setUserCode(v.getString());
	}

	if(f.equalsIgnoreCase(MENU_ID))
	{
		setMenuId(v.getString());
	}

	if(f.equalsIgnoreCase(MENU_CODE))
	{
		setMenuCode(v.getInt());
	}
	
}
public String toString()
{
	String msg = "UserMenuinfo=\n";
	msg += "(\r\n";

	msg += "    ID(id)="+get("id")+"\r\n";

	msg += "    用户ID(user_id)="+get("user_id")+"\r\n";

	msg += "    用户编码(user_code)="+get("user_code")+"\r\n";

	msg += "    菜单ID(menu_id)="+get("menu_id")+"\r\n";

	msg += "    菜单编码(menu_code)="+get("menu_code")+"\r\n";
		
	msg += ")\r\n";
	return msg;
}
public void copyBase(UserMenuinfoBase srcObj)
{

	setUserId(srcObj.getUserId());

	setUserCode(srcObj.getUserCode());

	setMenuId(srcObj.getMenuId());

	setMenuCode(srcObj.getMenuCode());

}

public String toXml() throws Exception
{
	String xml = "";
	xml += "<UserMenuinfo>";

	xml += "<Id>"+Value.view(getId())+"</Id>";

	xml += "<UserId>"+Value.view(getUserId())+"</UserId>";

	xml += "<UserCode>"+Value.view(getUserCode())+"</UserCode>";

	xml += "<MenuId>"+Value.view(getMenuId())+"</MenuId>";

	xml += "<MenuCode>"+Value.view(getMenuCode())+"</MenuCode>";
	
	xml += "</UserMenuinfo>";
	return xml;
}

}
